import { baseRequestClient, requestClient } from '#/api/request';

export namespace ItemRecpt {
  export interface Params {
    attr1: null;
  }
  export interface Row {
    [x: string]: any;
    searchValue: null;
    createBy: string;
    createTime: Date;
    updateBy: string;
    updateTime: Date | null;
    remark: string;
    params: Params;
    recptId: number;
    recptCode: string;
    recptName: string;
    iqcId: null;
    iqcCode: null;
    noticeId: null | number;
    noticeCode: null | string;
    poCode: null | string;
    vendorId: number;
    vendorCode: null | string;
    vendorName: string;
    vendorNick: string;
    ItemRecptId: null;
    ItemRecptCode: null;
    ItemRecptName: null;
    locationId: null;
    locationCode: null;
    locationName: null;
    areaId: null;
    areaCode: null;
    areaName: null;
    recptDate: Date;
    status: string;
    attr2: null;
    attr3: number;
    attr4: number;
    attr1: boolean | null | string;
  }
  export interface GetListParams {
    pageNum: number;
    pageSize: number;
  }
  export interface GetListReturn {
    total: number;
    rows: Row[];
    code: number;
    msg: string;
  }
}

// 获取列表
export const getItemRecptTableList = (params: ItemRecpt.GetListParams) =>
  requestClient.get<ItemRecpt.GetListReturn>('/mes/wm/itemrecpt/list', {
    params,
  });
// 增加入库单信息
export const addItemRecpt = (data: ItemRecpt.Row) =>
  requestClient.post<ItemRecpt.GetListReturn>('/mes/wm/itemrecpt', data);

// 删除入库单信息
export const deleteItemRecpt = (id: string) =>
  requestClient.delete<ItemRecpt.GetListReturn>(`/mes/wm/itemrecpt/${id}`);

// 修改入库单设置
export const updateItemRecpt = (data: ItemRecpt.Row) =>
  requestClient.put<ItemRecpt.GetListReturn>('/mes/wm/itemrecpt', data);

export const getItemRecptCode = () =>
  baseRequestClient.get<any>('/system/autocode/get/ITEMRECPT_CODE');
